<?php
require_once "config/koneksi.php";
require_once "class/produk.php";

$Produk_Dao = new Produk_Dao();
$produk = $Produk_Dao->get_all();
?>
<html>
<div align="center">
<table width=80%><tr><td>
<ul class="nav">
<table width=80% align=center><tr><td align=center height=29><font color=#FFFFFF>Produk Terlaris</font></td></tr></table>
</ul></tr></table>
	  <script language="javascript" src="js/jquery-1.4.js"></script>
	  <script language="javascript" src="js/headline.js"></script>
    <script type="text/javascript"> 
      $(document).ready(function(){
	  		// untuk permulaan, tampilkan content nomor 1 '#slideAwal'
	  		bukaContent($('#slideAwal'),'div1');			
	    });
	  </script>	

    <body>		  <div id="content">            

    <div id="divTrigger">
      <a href="javascript:;" onClick="bukaContent(this,'div1')" id="slideAwal">1</a>
      <a href="javascript:;" onClick="bukaContent(this,'div2')">2</a>
      <a href="javascript:;" onClick="bukaContent(this,'div3')">3</a>
      <a href="javascript:;" onClick="bukaContent(this,'div4')">4</a>
      <a href="javascript:;" onClick="bukaContent(this,'div5')">5</a>

    </div>

            <div id="divContent"><p>&nbsp;</p> 
            <table width=300 align=center border=1 cellspacing=0>
            <tr><td align=center valign=top width=100% height=16>
              <?php
			  $no=1;  
               foreach ($produk as $list){          	    
                  echo "<div id='div$no'>
                          <a href='?menu=view_produkdetil&&id_oleh2=$list->id_oleh2'/a><img src=images/gambar_produk/$list->gambar width='500' height='400'>
                        </div>";           
                  $no++;
                } 
              ?>
              </td>
			  </tr>
			  </table>
            </div></div>          
  </body>
<div align="center"><br>
<table width=80%><tr><td>
<ul class="nav">
<table width=80% align=center><tr><td align=center height=29><font color=#FFFFFF>Produk Terbaru</font></td></tr></table>
</ul></tr></table>
<br>
<table width="50%">
<tr>
<script language="javascript">
	function addtocart(pid){
		document.form1.productid.value=pid;
		document.form1.command.value='add';
		document.form1.submit();
	}
</script>
<?php
$kolom = 2;
$i=0;
foreach ($produk as $list){
if ($i >= $kolom){
echo "</tr><tr>";
$i=0;
}
    $i++;
      echo "<td align=center width=20% valign=top>
    		<div id=kotakjudul2>
            <span class=judulhead><a href='?menu=view_produkdetil&id_oleh2=".$list->id_oleh2."'>".$list->nama_oleh2."</a></span>
            </div>
            <div id=kotakisi2>
            <table border=0 width=80%><tr><td height=100 valign=top><a href='?menu=view_produkdetil&id_oleh2=$list->id_oleh2'><image src=\"images/gambar_produk/$list->gambar\"  width=\"245\" height=\"200\"></a><br /></td>
            <td width=80% valign=top>
			<br></br>
			</tr></table></td>
			</div>";

        }
echo"</table>";
?>
</div>
</div>
</ul>
  </html>
